<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="includes/top.jsp" />

<form:form modelAttribute="formFeed" >
    <form:input path="url" />
    <input type="submit" value="Submit feed" />
</form:form>

<c:if test="${!empty feeds}">
    <p class="order">Order feeds by <a href="feeds.htm?by=byTitle">Title</a> or <a href="feeds.htm?by=byDate">Date</a></p>
<ul id="rss-feeds">
<c:forEach var="feed" items="${feeds}">
    <li>
       <h4><a href="index.htm?feedId=${feed.id}" title="${feed.title}">${feed.title}</a></h4>
       <a class="remove-feed" href="remove-feed.htm?id=${feed.id}" title="Remove feed: ${feed.title}">Remove</a>

       <div class="feed-categories">
       <c:if test="${!empty feed.categories}">
       <ul>
       <c:forEach var="category" items="${feed.categories}">
            <li>
               <a href="category.htm?categoryId=${category.id}" title="${category.title}">${category.title}</a>
            </li>
        </c:forEach>
       </ul>
       </c:if>
           <a class="add-category" href="category.htm?feedId=${feed.id}" title="Add Category">Manage categories</a>
       </div>
    </li>
</c:forEach>
</ul>

</c:if>

<jsp:include page="includes/bottom.jsp" />